<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class UpdateForeignKey extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::table('templateParams', function(Blueprint $table)
		{
			$table->foreign('template_id')->references('id')->on('templates');
		});
		
		Schema::table('document_index', function(Blueprint $table)
		{
			$table->foreign('document_id')->references('id')->on('documents');
			$table->foreign('template_param_id')->references('id')->on('templateParams');
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		// Schema::table('templateParams', function(Blueprint $table)
		// {
			// $table->dropForeign('templateParams_template_id_foreign');
		// });
	}

}
